﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true"
    CodeBehind="Edit.aspx.cs" Inherits="Work.UI.Web.Forms.Admin.Employees.Edit" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="contentHeader" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <asp:ObjectDataSource ID="odsEmployee" runat="server" TypeName="Work.BL.Hibernate.Managers.HProfileEmployeeManager"
        DataObjectTypeName="Work.BL.POCOs.ProfileEmployeePOCO" SelectMethod="GetEmployeeById"
        UpdateMethod="Edit" OnObjectCreating="odsEmployee_ObjectCreating">
        <SelectParameters>
            <asp:QueryStringParameter Name="id" QueryStringField="Id" Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>


    <asp:FormView ID="frvEmployee" runat="server" DataSourceID="odsEmployee" DataKeyNames="Id"
        DefaultMode="Edit" OnItemUpdated="frvEmployee_ItemUpdate">
        <EditItemTemplate>
            <table class="addEdit">

                <tr>
                    <td>Name</td>
                    <td>
                        <asp:TextBox ID="tbName" Text='<%# Bind("Name") %>' runat="server"/>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                ErrorMessage="Required field"
                                ValidationGroup="employee"
                                ControlToValidate="tbName" 
                                Display="Dynamic"/>
                        <asp:RegularExpressionValidator ID="revSmallName" runat="server" 
                                ErrorMessage="Length should not exceed 25"                                                                                                             
                                ControlToValidate="tbName"
                                ValidationGroup="employee" 
                                ValidationExpression=".{1,25}"
                                Display="Dynamic" />
                    </td>
                </tr>

                <tr>
                    <td>Surname</td>
                    <td>
                        <asp:TextBox ID="tbSurname" Text='<%# Bind("Surname") %>' runat="server"/>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                                ErrorMessage="Required field"
                                ValidationGroup="employee"
                                ControlToValidate="tbSurname" 
                                Display="Dynamic"/>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                                ErrorMessage="Length should not exceed 25"                                                                                                             
                                ControlToValidate="tbSurname"
                                ValidationGroup="employee" 
                                ValidationExpression=".{1,25}"
                                Display="Dynamic" />
                    </td>
                </tr>

                
                 <asp:TextBox Visible="false" ID="TextBox1" Text='<%# Bind("Gender") %>' runat="server"/>
                    

                <tr>
                    <td>Birthday</td>
                    <td>
                        <asp:TextBox ID="tbBirthday" CssClass="date-field" Text='<%# Bind("Birthday") %>' runat="server"/>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                                ErrorMessage="Required field"
                                ValidationGroup="employee"
                                ControlToValidate="tbBirthday" 
                                Display="Dynamic"/>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                                ErrorMessage="Length should not exceed 25"                                                                                                             
                                ControlToValidate="tbBirthday"
                                ValidationGroup="employee" 
                                ValidationExpression=".{1,25}"
                                Display="Dynamic" />
                    </td>
                </tr>

                <tr>
                    <td>Phone</td>
                    <td>
                        <asp:TextBox ID="tbPhone" Text='<%# Bind("Phone") %>' runat="server"/>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                                ErrorMessage="Required field"
                                ValidationGroup="employee"
                                ControlToValidate="tbPhone" 
                                Display="Dynamic"/>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" 
                                ErrorMessage="Length should not exceed 25"                                                                                                             
                                ControlToValidate="tbPhone"
                                ValidationGroup="employee" 
                                ValidationExpression=".{1,25}"
                                Display="Dynamic" />
                    </td>
                </tr>

            </table>

            <asp:LinkButton ID="AddEmployee" runat="server" ValidationGroup="employee"
                onclick="AddEmployee_Click" CausesValidation="true" CssClass="button1">
                    <strong>Edit</strong>
                </asp:LinkButton>

            <asp:LinkButton ID="LinkButton1" runat="server" ValidationGroup="employee"
                onclick="Cansel_Click" CausesValidation="true" CssClass="button1">
                    <strong>Cansel</strong>
                </asp:LinkButton>

        </EditItemTemplate>
    </asp:FormView>
</asp:Content>
